﻿using Infrastructure.Attribute;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ZR.Model;
using ZR.Model.Dto.Business.ProductionControl;
using ZR.Model.Models.ProductionControl;
using ZR.Service.IService.ProductionControl;

namespace ZR.Service.Service.ProductionControl
{
    /// <summary>
    /// 三坐标数据追溯服务
    /// </summary>
    [AppService(ServiceType = typeof(ICksCMMItemService), ServiceLifetime = LifeTime.Transient)]
    public class CksCMMItemService : BaseService<CksCMMInspectionItem>, ICksCMMItemService
    {
        public List<CksCMMItemDto> GetList(CksCMMParamQueryDto param)
        {
            var response = Queryable()
                .OrderByDescending(x => x.CreateTime)
                .Where(x => x.BatchCode == param.BatchCode)
                .ToList<CksCMMItemDto>(x => new CksCMMItemDto()
                {
                    Id = x.Id,
                    ActualValue = x.ActualValue,
                    CheckResult = x.CheckResult,
                    CreateTime = x.CreateTime,
                    Idsymbol = x.Idsymbol,
                    ItemName = x.ItemName,
                    LSL = x.LSL,
                    StandardValue = x.StandardValue,
                    Unit = x.Unit,
                    USL = x.USL,
                    BatchCode = x.BatchCode
                });
            return response;
        }
    }
}